(deftemplate drumuri
    (slot plecare)
    (slot destinatie)
    (slot distanta)
    
    )

(assert (drumuri(plecare Toronto)(destinatie Vancover)(distanta 3000)))
(assert (drumuri(plecare Toronto)(destinatie LA)(distanta 3300)))
(assert (drumuri(plecare Toronto)(destinatie Chicago)(distanta 500)))
(assert (drumuri(plecare NY)(destinatie Toronto)(distanta 810)))
(assert (drumuri(plecare NY)(destinatie Chicago)(distanta 1100)))
(assert (drumuri(plecare NY)(destinatie Denver)(distanta 2500)))
(assert (drumuri(plecare Chicago)(destinatie Denver)(distanta 1000)))
(assert (drumuri(plecare Denver)(destinatie Memphis)(distanta 1200)))
(assert (drumuri(plecare Denver)(destinatie LA)(distanta 1000)))

(facts)

(defrule dinNY
    (drumuri(plecare NY)(destinatie ?dest)(distanta ?dist))
    =>
    (printout t "Din NY sunt zboruri catre " ?dest "(" ?dist "km)" crlf crlf)
    )
(run)

(defrule distanteConditie
    (drumuri ( plecare ?p)(destinatie ?d)(distanta ?dist))
    (test(< 800 ?dist))
    (test(< ?dist 2200))
    =>
    (printout t "Intre " ?p " si " ?d " sunt " ?dist " km" crlf)
    )
(run)
